//
//  Record.m
//  体育
//
//  Created by liujianlong on 2022/10/25.
//

#import "Record.h"

@implementation Record
+ (NSArray *)bg_unionPrimaryKeys
{
    return @[@"year",@"month",@"day",@"home",@"from"];
}
- (int)score_home{
    return self.top_half_score_home + self.bottom_half_score_home;
}
-(int)score_from{
    return self.top_half_score_from + self.bottom_half_score_from;
}
- (int)top_half_score_home{
    if (self.isbasketball) {
        return self.fir_score_home + self.sec_score_home;
    }else{
        return self.fir_score_home;
    }
}
- (int)top_half_score_from{
    if (self.isbasketball) {
        return self.fir_score_from + self.sec_score_from;
    }else{
        return self.fir_score_from ;
    }
}
- (int)bottom_half_score_home{
    if (self.isbasketball) {
        return self.thrd_score_home + self.fth_score_home;
    }else{
        return self.sec_score_home;
    }
}
- (int)bottom_half_score_from{
    if (self.isbasketball) {
        return self.thrd_score_from + self.fth_score_from;
    }else{
        return self.sec_score_from;
    }
}
- (BOOL)win{
    return self.score_home > self.score_from;
}
-(NSDateComponents *)date{
    return [NSDate dateOfStamp:self.stamp];
}
- (int)year{
    return  (int)self.date.year;
}
- (int)month{
    return  (int)self.date.month;
}
- (int)day{
    return  (int)self.date.day;
}
- (BOOL)finish{
    int stamp = [[NSDate currentTimeStamp:@"yyyy-MM-dd HH:mm:ss"] intValue];
    return self.stamp < stamp;
}
-(NSMutableArray *)imgs{
    if (!_imgs) {
        _imgs=[NSMutableArray array];
    }
    return _imgs;
}
@end
